﻿using System.Windows;
using Infragistics.Composite.Wpf.Docking;
using Infragistics.Composite.Wpf.Samples.ClockModule;
using Infragistics.Composite.Wpf.Samples.GoodbyeWorldModule;
using Infragistics.Composite.Wpf.Samples.HelloWorldModule;
using Infragistics.Composite.Wpf.Samples.SearchModule;
using Infragistics.Windows.DockManager;
using Microsoft.Practices.Composite.Modularity;
using Microsoft.Practices.Composite.UnityExtensions;
using Microsoft.Practices.Composite.Wpf.Regions;

namespace Infragistics.Composite.Wpf.SampleBrowser
{
    public class SampleBootstrapper : UnityBootstrapper
    {
        protected override IModuleEnumerator GetModuleEnumerator()
        {
            return new StaticModuleEnumerator()
                .AddModule(typeof(ClockModule))
                .AddModule(typeof(HelloWorldModule))
                .AddModule(typeof(GoodbyeWorldModule))
                .AddModule(typeof(SearchModule));
        }

        protected override DependencyObject CreateShell()
        {
            ShellWindow shell = new ShellWindow();
            shell.Show();
            return shell;
        }

        protected override RegionAdapterMappings ConfigureRegionAdapterMappings()
        {
            // Let the base class register the standard mappings.
            RegionAdapterMappings mappings = base.ConfigureRegionAdapterMappings();

            // Register a region adapter mapping for the XamDockManager.
            mappings.RegisterMapping(
                typeof(XamDockManager), 
                new XamDockManagerRegionAdapter());

            return mappings;
        }
    }
}